﻿/*
 * 文件名称：
 * 程序员：huangsb
 * 创建时间：2008/07/02
 * 
 * 功能说明：创建模板文件
 * 
 * 修改人员：
 * 
 * 修改日期：
 * 
 * 修改记录：
 */

using System;
using System.IO;

public partial class Whir_System_Module_Template_CreateTemplate : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string path = Server.UrlDecode(this.hfDir.Value) + "\\" + this.txt1.Text;
        if (File.Exists(path))
        {
            Response.Write("<script language=javascript>alert(\"已经存在【" + this.txt1.Text + "】文件，请确认！\");window.opener=null;window.open(\"\",\"_self\");window.close();</script>");
        }
        else
        {
            //创建文件
            Whir.Publish.CreateHtml.WriteFile(path, GetContent());

            //关闭窗口
            Response.Write("<script type='text/javascript'>window.returnValue=1;window.close();</script>");
        }
    }

    protected string GetContent()
    {
        string str = @"
<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
<html xmlns=""http://www.w3.org/1999/xhtml"">
<head>
    <title>{Whir.Label.SiteTitle/}</title>
    <meta http-equiv=""Content-type"" content=""Text/Html; Charset=utf-8"">
    <meta name=""Generator"" content=""万户网络"">
    <meta name=""Author"" content=""万户网络"">
    <meta name=""Keywords"" content=""{Whir.Label.MetaKey/}"">
    <meta name=""Description"" content=""{Whir.Label.MetaDesc/}"">
</head>
<body>

</body>
</html>";
        return str;
    }
}
